﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Blog.Models
{
    public class SettingModel
    {
        DataDataContext db = new DataDataContext();
        [DisplayName("Tiêu đề:")]
        public string Title { get; set; }

        [DisplayName("Weak comment:")]
        public string Status { get; set; }

        [DisplayName("Footer:")]
        public string Footer { get; set; }

        [DisplayName("CatalogAdd:")]
        public int CatalogAdd { get; set; }

        [DisplayName("CatalogDelete:")]
        public int CatalogDelete { get; set; }

        [DataType(DataType.Url)]
        [DisplayName("BackgroundImage:")]
        public string BackgroundImage { get; set; }
        public Setting GetByName(String str)
        {
            
           return   (  from c in db.Settings
                    where c.Atribute==str
                        select c).FirstOrDefault();
        }
        public void Save()
        {
            db.SubmitChanges();
        }

    }
  
}
